<template>
  <div>
    <div v-if="flag">
      <input @blur="flag=!flag" type="text" v-focus />
    </div>
    <div v-else>
      <button @click="btn">+ {{ tt }}</button>
    </div>
  </div>
</template>
<script>
/*
封装一个MyTag
1、初次进入显示按钮
2、点击显示表单
3、表单聚焦
4、按钮上或者表单需要有值
*/
export default {
  name: '',
  model: {
    prop: 'tt'
  },
  props: {
    tt: {
      type: String
    }
  },
  data () {
    return {
      flag: false
    }
  },
  created () {
  },
  computed: {
  },
  directives: {
    focus: {
      inserted (el) {
        el.focus()
      }
    }
  },
  methods: {
    btn () {
      this.flag = true

    }
  }
}
</script>
<style lang='less'  scoped>
</style>